﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Publicuse.Entity.AttributeUtil.Validate
{
    /// <summary>
    /// 不等于某个值验证
    /// </summary>
    public class NotequaltoAttribute : BaseValidateAttribute
    {
        private string notequalto = null;
        private string remark = null;

        public string GetNotequalto { get { return this.notequalto; } }

        public string GetRemark { get { return this.remark; } }

        public NotequaltoAttribute(string notequalto, string remark)
        {
            this.notequalto = notequalto;
            this.remark = remark;
        }

        public override bool Validate(object oValue)
        {
            if (oValue != null && !string.IsNullOrEmpty(oValue.ToString()))
            {
                return string.Compare(this.notequalto, oValue.ToString(), true) != 0;
            }
            else
            {
                return true;
            }
        }
    }
}
